package frame.laxcen.response;

import frame.laxcen.BaseFrame;
import frame.laxcen.dataobject.DataObject_0010_FF;
import frame.laxcen.exception.IllegalFrameFormatException;
import frame.laxcen.response.annotation.FrameFeature;
import frame.laxcen.util.FrameReader;

import java.util.HashMap;
import java.util.Map;

// 停止读写器所有的 RFID 操作的返回值
@FrameFeature(MessageType = 0b0010, Mid = (byte) 0xFF)
public class Response_0010_FF extends BaseResponse {

    public Response_0010_FF(BaseFrame baseFrame) throws IllegalFrameFormatException {

        super(baseFrame);

        getContentMap().putAll(explainToMap());
    }

    @Override
    protected Map<String, String> analyzeResponse(FrameReader reader) throws IllegalFrameFormatException {

        Map<String, String> result = new HashMap<>();

        // 查询结果

        switch(reader.readU8()) {

            case 0: result.put("查询结果", "停止成功"); break;
            case 1: result.put("查询结果", "系统错误"); break;
        }

        return result;
    }

    public DataObject_0010_FF getDataObject() {

        return new DataObject_0010_FF(getContentMap());
    }
}
